package com.lianboke.link.ad.ad;

import android.app.Activity;
import android.content.Context;

import abc.abc.abc.os.OffersManager;
import abc.abc.abc.os.PointsManager;

/**
 * 有米广告的工具类
 * Created by admin on 2018/2/27.
 */

public class YOUMiADUitil {

    /**
     * 设置服务器托管
     * @param actContext
     * @param userid
     */
    public static void setYOUMIUserInfo(Context actContext,String userid){
        OffersManager.getInstance(actContext).setCustomUserId(userid);
        OffersManager.getInstance(actContext).setUsingServerCallBack(true);
    }


    /**
     * 初始化有米
     */
    public static void   initYOUMIParams(Context actContext){
        OffersManager.getInstance(actContext).onAppLaunch();
    }

    /**
     * 销毁有米
     */
    public static void desYOUMIParams(Context actContext){
        OffersManager.getInstance(actContext).onAppExit();
    }

    /**
     * 展示半屏幕的积分墙
     * @param actContext
     */
    public static void fullScreenYOUMiOffersWall(Context actContext){
        OffersManager.getInstance(actContext).showOffersWall();
//        OffersManager.getInstance(actContext).showOffersWall(Interface_ActivityListener listener);
    }

    /**
     * 半屏积分墙
     * @param actContext
     * @param activity
     */
    public static void halfScreenYOUMIOffersWall(Context actContext, Activity activity){
        OffersManager.getInstance(actContext).showOffersWallDialog( activity);
    }

    /**
     * 获取用户余额
     * @param actcontext
     * @return
     */
    public static float queryPoints(Context actcontext){
        return PointsManager.getInstance(actcontext).queryPoints();
    }

    /**
     * 扣除积分
     * @param actContext
     * @param points
     * @return
     */
    public static boolean spendPoints(Context actContext,float points){
       return PointsManager.getInstance(actContext).spendPoints( points);
    }

    /**
     * 增加积分
     * @param actContext
     * @param points
     * @return
     */
    public static boolean awardPoints(Context actContext,float points){
        return PointsManager.getInstance(actContext).awardPoints(points);
    }

    public interface Interface_ActivityListener{
        /**
         * 全屏积分墙Activity 调用onDestory的时候回调，执行在ui线程中
         */
        public void onActivityDestroy(Context context);
    }

}
